﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OneMile.DAL;
using OneMile.Entity.Model;
    

namespace OneMile.BLL
{
    public class BLLUUserAddress:BaseBLL
    {
        private DALUUserAddress dalUserAddress;

        public DALUUserAddress DALUserAddress
        {
            get
            {
                if (dalUserAddress == null)
                {
                    dalUserAddress = DALFactory.getInstance().CreateUUserAddressDAL();
                }
                return dalUserAddress;
            }
        }

        public bool IsAddressExit(string AddressName, string UserId)
        {
            try
            {
                return DALUserAddress.IsAddressExit(AddressName, UserId);
            }
            catch (Exception e)
            {
                
                base.WriteLog(e.Message);
                throw e;
            }
        }

        public bool DelUserAddress(string userAddressId)
        {
            try
            {
                return DALUserAddress.DelUserAddress(userAddressId);
            }
            catch (Exception e)
            {
                base.WriteLog(e.Message);
                throw e;
            }
        }

        public bool UpdateUserAddress(EUserAddress userAddress)
        {
            try
            {
                return DALUserAddress.UpdateUserAddress(userAddress);
            }
            catch (Exception e)
            {
                base.WriteLog(e.Message);
                throw e;
            }
        }

        public bool AddUserAddress(EUserAddress userAddress)
        {
            try
            {
                return DALUserAddress.AddUserAddress(userAddress);
            }
            catch (Exception e)
            {
                base.WriteLog(e.Message);
                throw e;
            }
        }

        public IList<EUserAddress> GetUserAddressListByUserId(string userId)
        {
            try
            {
                return DALUserAddress.GetUserAddressListByUserId(userId);
            }
            catch (Exception e)
            {
                base.WriteLog(e.Message);
                throw e;
            }
        }
    }
}
